﻿<!-- 
// (c) Copyright Webber-Cross Software Ltd.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->
    
    <UserControl x:Class="WebberCross.BdcModelBuilder.TabControls.DataSourceTab"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid Margin="10" x:Name="grid">
        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition Height="35"/>
            <RowDefinition Height="35"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="10"/>
            <RowDefinition Height="35"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="35" />
        </Grid.ColumnDefinitions>
        
        <Label>Object:</Label>
        <Label Grid.Row="1">Namespace:</Label>
        <Label Grid.Row="2">Constructor:</Label>

        <TextBox x:Name="tbDataSource" Margin="3" Grid.Column="1" IsEnabled="{Binding Path=ModelContainer.EditMode}" Text="{Binding Path=ModelContainer.CurrentModel.DataSourceInstance.NestedInstances[0].InstanceTypeFullName}" />
        <TextBox x:Name="tbNameSpace" Margin="3" Grid.Column="1" IsEnabled="False" Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding Path=ModelContainer.CurrentModel.DataSourceInstance.NestedInstances[0].InstanceTypeNameSpace}"/>

        <DataGrid x:Name="dgConstructors" Margin="3" Grid.Row="3" IsEnabled="{Binding Path=ModelContainer.EditMode}" ItemsSource="{Binding Path=ModelContainer.CurrentModel.DataSourceInstance.ConstructorParameters}"
                  Grid.ColumnSpan="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" HorizontalGridLinesBrush="Gray" 
                  VerticalGridLinesBrush="Gray" RowHeight="25">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Name" Width="250" Binding="{Binding Name}" IsReadOnly="True" />
                <DataGridTextColumn Header="Value" Width="250" Binding="{Binding Value}"/>
                <DataGridTextColumn Header="Config Key" Width="250" Binding="{Binding CfgKey}"/>
            </DataGrid.Columns>
        </DataGrid>

        <Label Grid.Row="5">Properties:</Label>
        
        <DataGrid x:Name="dgProperties" Margin="3" Grid.Row="6" IsEnabled="{Binding Path=ModelContainer.EditMode}" ItemsSource="{Binding Path=ModelContainer.CurrentModel.DataSourceInstance.InstancePaths}"
                  Grid.ColumnSpan="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" 
                  HorizontalGridLinesBrush="Gray" VerticalGridLinesBrush="Gray" RowHeight="25">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Path" Width="250" Binding="{Binding Path}" IsReadOnly="True"/>
                <DataGridTextColumn Header="Value" Width="250" Binding="{Binding Value}"/>
                <DataGridTextColumn Header="Config Key" Width="250" Binding="{Binding CfgKey}"/>
            </DataGrid.Columns>
        </DataGrid>

        <Button x:Name="btnObject" Margin="3" Grid.Column="2" IsEnabled="{Binding Path=ModelContainer.EditMode}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Content="..." Command="{Binding DSVM.DataSourceCommand}" />
        
    </Grid>
</UserControl>
